<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="format-detection" content="telephone=no" />
  <title>墨点课堂-在线教育书画学习平台</title>
  <meta
    content="墨点字帖,硬笔书法,毛笔书法,规范字书法在线教育,书画作品,在线培训,荆霄鹏楷书,新新图书"
    name="keywords"
  />
  <meta
    content="“墨点课堂”隶属于墨点旗下在线书画学习平台，公司积累了20多年字帖出版资源，致力于为用户提供专业的书画学习及教育服务，弘扬中国传统文化！一流的师资力量，精心的课程研发，采用在线互动教学形式，实现了APP内教学、服务一体化运营。"
    name="description"
  />
  <meta
    name="viewport"
    content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0 minimal-ui"
  />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />

  <link href="../css/reset.css" rel="stylesheet" />
  <link href="../css/public.css" rel="stylesheet" />
  <link href="../css/style.css" rel="stylesheet" />
  <link href="../icon/iconfont.css" rel="stylesheet" />
  <link rel="stylesheet" href="../js/layer/need/layer.css" />
  <link rel="stylesheet" type="text/css" href="../icon/iconfont-v4.css" />
  <link rel="stylesheet" type="text/css" href="../icon/eduline-icon.css" />
  <style>
    @font-face {
      font-family: "iconfontNEW";
      src: url("https://www.modianketang.com/addons/theme/stv1/_static/icon/iconfontNEW.woff?v={$site.sys_version}");
    }
    .iconfontNEW {
      font-family: iconfontNEW;
    }
  </style>
  <link
    rel="shortcut icon"
    href="../assets/images/logo.png"
    type="image/x-icon"
  />

  <script>
    //全局变量
    var SITE_URL = "https://www.modianketang.com";
    var UPLOAD_URL = "https://www.modianketang.com/data/upload";
    var THEME_URL = "https://www.modianketang.com/addons/theme/stv1/_static";
    var APPNAME = "basic";
    var MID = parseInt("0");
    var UID = "0";
    var initNums = "140";
    var SYS_VERSION = "20180814";
    var _ROOT_ = "https://www.modianketang.com";
    // Js语言变量
    var LANG = new Array();
    //注册登录模板
    var REG_LOGIN =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=regLogin";
    //邮箱验证地址
    var CLICK_EMIL =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=clickEmail";
    //异步注册地址
    var REG_ADDRESS =
      "http://192.168.200.132:17777/api/study/register/individual";
    //异步登录
    var LOGIN_ADDRESS =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=ajaxLogin";
    //退出登录
    var LOGINOUT_ADDRESS =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=logout";
    //手机号正则
    var PHONE_MATCH =
      /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/;
    //邮箱正则
    var EMAIL_MATCH = /([\w\-\.]+\@[\w\-\.]+\.[\w\-\.]+)/;
  </script>
  <script src="../js/jquery-1.8.3.min.js" charset="utf-8"></script>
  <script src="../js/core.js" charset="utf-8"></script>
  <script src="../js/header_footer.js" charset="utf-8"></script>
  <script src="../js/index.js" charset="utf-8"></script>
  <script src="../js/layer/layer.js" charset="utf-8"></script>
  <script src="../js/ui.layer_w3g.js" charset="utf-8"></script>
</head>
<body>
  <!--preloader-->
  <div id="preloader">
    <div id="status">
      <p class="center-text">
        数据加载中...
        <em>加载速度取决于你的网络情况</em>
      </p>
    </div>
  </div>
  <!--header-->

  <script>
    var CLICK_VERIFY =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=clickVerify";
    var CLICK_UNAME =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=clickUname";
    var CLICK_PHONE = "http://192.168.200.132:17777/api/study/check/phone";
    var CLICK_PHONEVER =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=clickPhoneVer";
    var SETUSERFACE =
      "https://www.modianketang.com/index.php?app=basic&mod=Passport&act=setUserFace";
    var GET_PHONEVERIFY =
      "http://192.168.200.132:17777/api/study/mobile/sendcode";
    //异步注册地址
    var REG_ADDRESS =
      "http://192.168.200.132:17777/api/study/register/individual";
  </script>
  <style>
    #emailReg .item input {
      float: none;
    }
    .login-bd input::-webkit-input-placeholder {
      /* WebKit, Blink, Edge */
      color: #b7b7b7;
      font-weight: 400;
    }
    .login-bd input:-moz-placeholder {
      /* Mozilla Firefox 4 to 18 */
      color: #b7b7b7;
      font-weight: 400;
    }
    .login-bd input::-moz-placeholder {
      /* Mozilla Firefox 19+ */
      color: #b7b7b7;
      font-weight: 400;
    }
    .login-bd input:-ms-input-placeholder {
      /* Internet Explorer 10-11 */
      color: #b7b7b7;
      font-weight: 400;
    }
    .login-bd .item input {
      float: none;
      width: 100%;
    }
  </style>
  <div class="loginbox">
    <a class="icon-colse" href="/"></a>
    <img src="../assets/images/header.png" class="login-logo" />
    <div class="login-hd">
      <li><a href="./login.html">登录</a></li>
      <li>|</li>
      <li class="on"><a href="javascript:;">注册</a></li>
    </div>

    <p>
      <a href="javascript:;" onclick="phoneReg(this)">手机注册</a
      >&nbsp;或者&nbsp;<a href="javascript:;" onclick="emailReg(this)"
        >邮箱注册</a
      >
    </p>
    <input type="hidden" id="this_mhm_id" value="0" />
    <input type="hidden" id="invite_code" value="" />

    <div class="login-bd" id="phoneReg" style="display: block">
      <div class="item">
        <input type="text" id="prphone" placeholder="请输入手机号" />
      </div>
      <div class="item">
        <input type="text" id="prverify" placeholder="请输入验证码" />
        <a class="yzm width80" href="javascript:;" onclick="getPhoneVerify()"
          >获取验证码</a
        >
        <span class="width97" style="display: none"
          ><a id="dtime" style="display: inline-block"></a>秒后可重新发送</span
        >
      </div>
      <div class="item">
        <input
          type="text"
          id="uname"
          maxlength="10"
          placeholder="请输入用户昵称（不能为特殊字符）"
        />
      </div>
      <div class="item">
        <input
          type="password"
          id="prpassword"
          placeholder="请输入密码（不能为特殊字符）"
        />
      </div>
      <div class="item">
        <input type="password" id="prpassword2" placeholder="确认密码" />
      </div>
      <!--
                <p><input type="checkbox"><span>我已阅读并同意</span><a target="_blank" href="https://www.modianketang.com/single/reg.html">《墨点课堂服务协议》</a></p>
                -->
      <a class="login_btn" href="javascript:;" onclick="phoneNext()">完成</a>
      <p>
        点击注册即代表您同意<a
          target="_blank"
          href="https://www.modianketang.com/single/reg.html"
          >《墨点课堂服务协议》</a
        >
      </p>
    </div>
    <div class="login-bd" id="emailReg" style="display: none">
      <div class="item">
        <input type="text" id="erusername" placeholder="请输入邮箱" />
      </div>
      <div class="item">
        <input
          type="text"
          id="eruname"
          maxlength="10"
          placeholder="请输入用户昵称（不能为特殊字符）"
        />
      </div>
      <div class="item">
        <input
          type="password"
          id="erpasswrod"
          placeholder="请输入密码（不能为特殊字符）"
        />
      </div>
      <div class="item">
        <input type="password" id="erpasswrod2" placeholder="确认密码" />
      </div>
      <div class="item">
        <input type="text" id="erverify" placeholder="请输入右侧验证码" />
        <span id="verifyimg_loading">验证码加载中...</span>
        <img
          class="yzm-3g resetcode"
          src="/"
          title="点击刷新"
          id="verifyimg"
          style="display: none"
        />
      </div>
      <a class="login_btn" href="javascript:;" onclick="onemaliNext()">完成</a>
      <p>
        点击注册即代表您同意<a
          target="_blank"
          href="https://www.modianketang.com/single/reg.html"
          >《墨点课堂服务协议》</a
        >
      </p>
    </div>
  </div>

  <script>
    $(function () {
      $(".loginbox").height($(".loginbox")[0].clientHeight);
      $("#preloader").hide();
      var codeSrc =
        "https://www.modianketang.com/index.php?app=basic&mod=Captcha&act=index&id=register&config[imageW]=128&config[imageH]=28&!" +
        Math.random();

      $(".resetcode")
        .attr("src", codeSrc)
        .load(function () {
          $("#verifyimg_loading").remove();
          $(this).show();
        });

      /** 刷新验证码 */
      $(".resetcode").click(function () {
        $(".resetcode").attr("src", function () {
          var index = this.src.indexOf("&!");
          if (index !== -1) {
            return this.src.substr(0, index) + "&!" + Math.random();
          }
          return this.src + "&!" + Math.random();
        });
      });

      // 每60s 刷新一次验证码
      setInterval(function () {
        $(".resetcode").click();
      }, 120 * 1000);
    });
    //手机注册
    function phoneReg(cate) {
      $(cate).addClass("f3");
      $(cate).prev().removeClass();
      $("#phoneReg").css("display", "block");
      $("#emailReg").css("display", "none");
    }
    //邮箱注册
    function emailReg(cate) {
      $(cate).addClass("f3");
      $(cate).prev().removeClass();
      $("#emailReg").css("display", "block");
      $("#phoneReg").css("display", "none");
    }
    /**
     * 发送手机验证码
     */
    function getPhoneVerify() {
      user = $.trim($("#prphone").val()); //获取用户手机号
      var phoneVerify = function () {
        //获取手机验证码
        $.ajax({
          type: "POST",
          url: GET_PHONEVERIFY,
          data: JSON.stringify({
            mobile: user,
          }),
          dataType: "json",
          contentType: "application/json",
          success: function (data) {
            console.log(data);
            if (data.ret == 1) {
              ui.error(data.msg);
              return;
            } else {
              ui.success(data.msg);
              $(".width80").css("display", "none");
              $(".width97").removeAttr("style");
              timerc = 60;
              dtime();
              return;
            }
          },
        });
      };
      //检查手机号格式
      if (!user.match(PHONE_MATCH)) {
        ui.error("请填写正确的手机号");
        return;
      } else {
        //验证此手机是否已被注册
        $.ajax({
          type: "POST",
          url: CLICK_PHONE,
          data: JSON.stringify({
            mobile: user,
          }),
          dataType: "json",
          contentType: "application/json",
          success: function (data) {
            if (data.ret == 1) {
              ui.error(data.msg);
              return;
            } else {
              phoneVerify();
            }
          },
        });
      }
    }
    var timerc;
    function dtime() {
      if (timerc > 1) {
        timerc = timerc - 1;
        $("#dtime").text(timerc);
        setTimeout("dtime()", 1000); //设置1000毫秒以后执行一次本函数
      } else {
        $(".width97").css("display", "none");
        $(".width80").removeAttr("style");
      }
    }

    //邮箱注册下一部
    function onemaliNext() {
      user = $.trim($("#erusername").val()); //获取用户邮箱地址
      verify = $.trim($("#erverify").val()); //获取验证码
      uname = $.trim($("#eruname").val()); //获取用户昵称
      password = $.trim($("#erpasswrod").val()); //获取密码
      password2 = $.trim($("#erpasswrod2").val()); //获取密码
      mhm_id = $.trim($("#this_mhm_id").val()); //机构
      invite_code = $.trim($("#invite_code").val()); //邀请码

      //检查信息是否为空
      if (user == "") {
        ui.error("请输入邮箱");
        return;
      }
      if (uname == "") {
        ui.error("请输入昵称");
        return;
      }
      if (password == "") {
        ui.error("请输入密码");
        return;
      }
      if (password2 == "") {
        ui.error("请再次输入密码");
        return;
      }
      if (verify == "") {
        ui.error("请输入验证码");
        return;
      }

      //验证邮箱
      if (
        !user.match(
          /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/
        )
      ) {
        ui.error("邮箱格式错误");
        return;
      }

      //验证昵称
      if (uname.length > 10) {
        ui.error("昵称长度不能大于10位");
        return;
      }

      //检查密码
      if (password.length < 6 || password.length > 20) {
        ui.error("密码长度为6-20位");
        return;
      }
      if (password != password2) {
        ui.error("两次输入密码不一致");
        return;
      }

      //检查验证码
      if (verify.length != 4) {
        ui.error("验证码长度不正确");
        return;
      }

      $.ajax({
        async: false,
        type: "POST",
        url: REG_ADDRESS,
        data: JSON.stringify({
          account: uname,
          code: verify,
          email: user,
          password: password,
        }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
          if (data.ret == 1) {
            ui.error(data.info);
            return;
          } else {
            ui.success("注册成功");
            location.href = "./login.html";
          }
        },
      });
    }

    //手机注册下一部
    function phoneNext() {
      user = $.trim($("#prphone").val()); //获取用户邮箱地址
      verify = $.trim($("#prverify").val()); //获取验证码
      uname = $.trim($("#uname").val()); //获取用户昵称
      password = $.trim($("#prpassword").val()); //获取密码
      password2 = $.trim($("#prpassword2").val()); //获取密码
      mhm_id = $.trim($("#this_mhm_id").val()); //机构
      invite_code = $.trim($("#invite_code").val()); //邀请码

      //检查信息是否为空
      if (user == "") {
        ui.error("请输入手机号");
        return;
      }
      if (verify == "") {
        ui.error("请输入验证码");
        return;
      }
      if (uname == "") {
        ui.error("请输入昵称");
        return;
      }
      if (password == "") {
        ui.error("请输入密码");
        return;
      }
      if (password2 == "") {
        ui.error("请再次输入密码");
        return;
      }

      //检查手机号格式
      if (!user.match(PHONE_MATCH)) {
        ui.error("请填写正确的手机号");
        return;
      }

      //检查验证码
      if (verify.length != 6) {
        ui.error("手机验证码长度不正确");
        return;
      }

      //验证昵称
      if (uname.length > 10) {
        ui.error("昵称长度不能大于10位");
        return;
      }

      //检查密码
      if (password.length < 6 || password.length > 20) {
        ui.error("密码长度为6-20位");
        return;
      }
      if (password != password2) {
        ui.error("两次输入密码不一致");
        return;
      }

      $.ajax({
        async: false,
        type: "POST",
        url: REG_ADDRESS,
        data: JSON.stringify({
          account: uname,
          code: verify,
          phone: user,
          password: password,
        }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
          if (data.ret == 1) {
            ui.error(data.msg);
            return;
          } else {
            ui.success("注册成功");
            location.href = "./login.html";
          }
        },
      });
    }
  </script>
</body>
